package com.mykt.prox;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
public class ProxyHandler  implements InvocationHandler{
    private Object target;

    public  ProxyHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        // 在方法调用前后可以添加你自己的逻辑处理
        System.out.println("Before method invoking");
        Object result = method.invoke(target, args);
        System.out.println("After method invoking");




        return result;
    }
}
